﻿<%@ page language="java" pageEncoding="utf-8"%>
<%@ page import="java.util.*"%>
<%@ page import="javax.servlet.http.HttpServletRequest"%>
<%@ page import="org.jbit.bean.*,org.jbit.biz.*,org.jbit.dao.*,org.jbit.vo.*"%>
<!DOCTYPE html>
<%
     String user = (String) request.getSession().getAttribute("user");
     UserDao UD=new UserDao();
     String ModuleMark=UD.ModuleMarkByUserName(user);
     GPSInfoListAction GA = new GPSInfoListAction();
     GPSInfoVo info=new GPSInfoVo();
     info=GA.getGPSInfoShow(ModuleMark);
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的车辆</title>
<link rel="stylesheet" type="text/css" href="../css/button.css" />
<link rel="stylesheet" type="text/css" href="../css/table.css" />
<link href="../js/jquery/css/ui.jqgrid.css" type="text/css" rel="stylesheet" />
<link href="../js/jquery/css/jquery-ui-1.10.3.custom.min.css"	type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery/jquery-1.9.1.js"></script>
<script type="text/javascript" src="../js/jquery/jquery.jqGrid.min.js"></script>
<script type="text/javascript" src="../js/jquery/i18n/grid.locale-cn.js"></script>
<script type="text/javascript" src="../js/jquery/jquery-ui-1.10.3.custom.min.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?key=&v=1.1&services=true"></script> 
<script type="text/javascript">
	$(function() {
	$("#gridTableDetail").jqGrid({
	url : "../GPSInfoQueryAction?method=listDetail",
	datatype : "json",
	mtype : "GET",
	height :"auto",
	width :$(window).width()*0.88,
	colModel : [ {
	name : "carId",index : "carId",	label : "车牌号",align : "center",classes : "myFontClass"}, {
	name : "realName",index : "realName",	label : "姓名",align : "center",classes : "myFontClass"}, {
	name : "county",index : "county",	label : "户主所在地",align : "center",classes : "myFontClass"}, {
	name : "userPhone",index : "userPhonenty",	label : "用户联系电话",align : "center",classes : "myFontClass"}, {
	name : "moduleMark",index : "moduleMark",label : "GPRS编号",align : "center",	classes : "myFontClass"}, {
	name : "regitTime",index : "regitTime",label : "注册时间",align : "center",	classes : "myFontClass"}, {
	name : "UTCTime",index : "UTCTime",label : "数据时间",align : "center",	classes : "myFontClass"}, {
	name : "latitude",index : "latitude",label : "经度",align : "center",classes : "myFontClass"}, {
	name : "longitude",index : "longitude",label : "纬度",align : "center",	classes : "myFontClass"}, {
	name : "GPSStatue",index : "GPSStatue",label : "GPS状态",align : "center",classes : "myFontClass"},{
	name : "satellite_Number",index : "satellite_Number",label : "卫星数量",align : "center",classes : "myFontClass"},{
	name : "status",index : "status",label : "车辆状态",align : "center",classes : "myFontClass"},
	],
	viewrecords : true,
	rowNum : 15,
	rowList : [ 10, 15, 20 ],
	prmNames : {
	search : "search"
	}, //(1)
	jsonReader : {
	root : "gridModel",
	records : "record",
	repeatitems : false
	},
	sortname : "moduleMark",
	sordorder : "desc",
	multiselect : true,
	pager : "#gridPager1",
	hidegrid : false,
	
	});
	$( "#dialog-form-Detail" ).dialog({
	autoOpen: false,
	height: "auto",
	width: $(window).width()*0.92,
	modal: true,
	buttons: {
	"关闭": function() {
	$( this ).dialog( "close" );
	},
	"行驶痕迹(文字)": function() {
	window.open ("./ShowWord.jsp?ModuleMark="+<%=ModuleMark%>,"newwindow", "height=800, width=1550, top=0,left=0, toolbar=no,menubar=no, scrollbars=no, resizable=no,location=no, status=no");  
	},
	"行驶痕迹(地图)": function() {
	window.open ("./ShowLine.jsp?ModuleMark="+<%=ModuleMark%>,"newwindow", "height=800, width=1550, top=0,left=0, toolbar=no,menubar=no, scrollbars=no, resizable=no,location=no, status=no");  
	}
	},
	close: function() {
	}
	});
	});
	
	function Detail(moduleMark)
	{
	$("#gridTableDetail").jqGrid('setGridParam', {
	datatype : 'json',
	postData : {
	'ModuleMark' :moduleMark,
	}, //发送数据
	page : 1
	}).trigger("reloadGrid"); //重新载入
	$("#dialog-form-Detail").dialog("open");
	}
	setInterval("timer.innerHTML=new Date().toLocaleString()+'&nbsp;&nbsp;星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);
	function DropDown(el) {
	this.dd = el;
	this.initEvents();
	}
	DropDown.prototype = {
	initEvents : function() {
	var obj = this;
	obj.dd.on('click', function(event){
	$(this).toggleClass('active');
	event.stopPropagation();
	});
	}
	};
	$(function() {
	new DropDown( $('#dd') );
	$(document).click(function() {
	$('.wrapper-dropdown-5').removeClass('active');
	});
	});
	var gc = new BMap.Geocoder();
	var x=<%=info.getLongitude() %>;
	var y=<%=info.getLatitude() %>;
	var pt = new BMap.Point(parseFloat(x),parseFloat(y));
	var dress = gc.getLocation(pt, function(rs)
	{
	var addComp = rs.addressComponents;
	$('#place').val(addComp.province+addComp.city+addComp.district+addComp.street+addComp.streetNumber);
	});
	
	function site(id)
{
//var rowData = $("#gridTableDetail").getRowData(id);	
alert("hello"); 

}
	</script>
	</head>
	<body>
	<div class="header">
	<div class="container">
	<div class="wrapper-demo">
	<div id="dd" class="wrapper-dropdown-5" ><%=(String) request.getSession().getAttribute("user") %>
	<ul id="tags" class="dropdown">
	<li><a href="../User/person.jsp"><i></i>个人中心</a></li>
	<li><a href="../loginByType/User.jsp"><i></i>车辆追踪</a></li>
	<li><a href="../User/carInfo.jsp"><i></i>车辆信息</a></li>
	<li><a href="../login.jsp"><i class="icon-remove"></i>安全退出</a></li>
	</ul>
	</div>
	</div>
	</div>
	</div>
	<div id="timer" class="timer" align="center"></div>
	<div class="tablemain" id="tablemain" align="center">
	<table>
	<tr class="main"><td colspan="2"><div align="center">我的车辆信息</div></td></tr>
	<tr><td><div align="center"><%="车牌" %></div></td><td><div align="left"><%=info.getCarId() %></div></td></tr>
	<tr><td><div align="center"><%="注册时间" %></div></td><td><div align="left"><%=info .getRegitTime() %></div></td></tr>
	<tr><td><div align="center"><%="户主所在地" %></div></td><td><div align="left"><%=info.getCounty() %></div></td></tr>
	<tr><td><div align="center"><%="联系电话" %></div></td><td><div align="left"><%=info.getUserPhone() %></div></td></tr>
	<tr><td><div align="center"><%="GPRS号" %></div></td><td><div align="left"><%=info.getModuleMark() %></div></td></tr>
	<tr><td><div align="center"><%="数据时间" %></div></td><td><div align="left"><%=info.getUTCTime() %></div></td></tr>
	<tr><td><div align="center"><%="纬度" %></div></td><td><div align="left"><%=info.getLatitude() %></div></td></tr>
	<tr><td><div align="center"><%="经度" %></div></td><td><div align="left"><%=info.getLongitude() %></div></td></tr>
	<tr><td><div align="center"><%="车辆位置" %></div></td><td><div align="left"><input type="text" name="place" id="place" readonly ></div></td></tr>
	<tr><td><div align="center"><%="GPS状态" %></div></td><td><div align="left"><%=info.getGPSStatue() %></div></td></tr>
	<tr><td><div align="center"><%="卫星数量" %></div></td><td><div align="left"><%=info.getSatellite_Number() %></div></td></tr>
	<tr><td colspan="2" ><div align="center"><a href="#" onClick="Detail(<%=ModuleMark%>)">历史轨迹</a></div></td></tr>
</table>
</div>
<div id="dialog-form-Detail">
<table id="gridTableDetail"></table>
<div id="gridPager1"></div>
<div id="placeList" style="display: none">
</div>
</div>
</body>
</html>
